<div class="main-content">
    <div class="section__content section__content--p20">
        <div class="container-fluid">
            <div class="row m-b-30">
                <div class="col-lg-12">
                    <div class="overview-wrap">
                        <h2 class="title-1"><?php
                            if ($lang['lang'] == 'xmcms') {
                                echo '后台语言编辑';
                            } else {
                                echo '语言编辑';
                            }
                            ?>
                            :<?php echo $lang['name']; ?></h2>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <div class="card">
                        <div class="card-header">
                            <strong><?php
                                if ($lang['lang'] == 'xmcms') {
                                    echo '后台语言编辑';
                                } else {
                                    echo '语言编辑';
                                }
                                ?>
                                :<?php echo $lang['name']; ?></strong>
                        </div>
                        <div class="card-body">
                            <form class="form-horizontal" role="form" name="form" id="form" method="post"
                                  data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
                                  data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
                                  data-bv-feedbackicons-validating="glyphicon glyphicon-refresh"
                                  action="index.php?r=admin/language/edit">
                                <input type="hidden" name="id" value="<?php echo $lang['id']; ?>"/>
                                <input type="hidden" name="mark" value="<?php echo $lang['mark']; ?>"/>
                                <input type="hidden" name="YII_CSRF_TOKEN" value="<?php echo Yii::app()->request->csrfToken; ?>"/>

                                <div class="form-group">
                                    <label class=" form-control-label">语言</label>
                                    <div><?php echo $lang['name']; ?></div>
                                </div>

                                <div class="form-group">
                                    <label class=" form-control-label">启用</label>
                                    <input name="useok"  class="form-control"  type="radio"
                                           value="1" <?php echo $lang['useok'] == 1 ? "checked='checked'" : ""; ?>/>是&nbsp;&nbsp;<input
                                            value="0" name="useok"  class="form-control"  type="radio"/>否
                                </div>

                                <div class="form-group">
                                    <label class=" form-control-label">默认语言</label>
                                    <input type="radio" class="form-control" name="isdefault"
                                           value="1" <?php echo $lang['isdefault'] == 1 ? "checked='checked'" : ""; ?>/>是&nbsp;&nbsp;<input
                                            value="0" <?php echo $lang['isdefault'] == 0 ? "checked='checked'" : ""; ?> name="isdefault"  class="form-control"  type="radio"/>否
                                </div>

                                <div class="form-group">
                                    <button  type="submit" name="submit" id="submit" class="btn btn-primary btn-lg btn-block">保存</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(document).ready(function () {
        initPage();
    });
    function initPage() {
        $('#form').bootstrapValidator();
        $('#form').ajaxForm({
            dataType: 'json',
            beforeSubmit: function (formData, jqForm, options) {
                return $('#form').data('bootstrapValidator').isValid();
            },
            success: function (res) {
                if (message(res)) {
                    window.location.href = "index.php?r=admin/language/index";
                }
            }
        });
    }
    function enableForm() {
        $("input[name=submit]").removeProp("disabled");
    }
</script>